<?php

class Application_Model_News extends Application_Model_DbTable_News
{
    public function fetchAllNews()
    {
        $select = $this->select()->order(array('createdDate DESC', 'id DESC'));
        return $this->fetchAll($select);
    }
    
    public function updateNews(array $data, $id)
    {
        $this->lastChangedDate = time();
        $where = $this->getAdapter()->quoteInto('id = ?', $id);
        return $this->update($data, $where);
    }
    
    public function deleteNews($id)
    {
        $where = $this->getAdapter()->quoteInto('id = ?', $id);
        return $this->delete($where);
    }
    
}

